home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.3 / Video Toaster v4.3.iso / 4.2 / arexx / editor / startupscripts / measure.rexx < prev   
OS/2 REXX Batch file  |  1998-04-16  |  2KB  |  104 lines

  1. /* Mesure.rexx V1.1 -- Measure between 2 selected clips.                  */
  2. /* By Bob Caron (Grue) ©1995 NewTek Inc.                                  */
  3.  
  4. arg frompopup
  5. set numeric 12
  6. if frompopup="" then frompopup=0
  7.  
  8. frompopup=1
  9. call remlib('PROJECT_REXX_PORT')
  10.  
  11. call addlib('PROJECT_REXX_PORT',0)
  12. if frompopup=0 then do
  13.   call req_tell("Measure V1.0","This script can only be run","from the tools popup.")
  14.   call quit()
  15.   end
  16.  
  17. call set_view(2)
  18.  
  19. call req_error("Measure V1.0     ---   Total time from in point (Clip 1) to out point (Clip 2)")
  20.  
  21. project_end=croutonsinproject()
  22. location=1
  23. do count=1 to project_end
  24.   if croutonselectedpos(count)=1 then do
  25.      selected.location=count-1
  26.      location=location+1
  27.      end
  28. end
  29.  
  30. location=location-1
  31.  
  32. if location<=0 then do
  33.    call req_tell("Measure V1.0","       You need to select two","     croutons Measure between.")
  34.    call quit()
  35.    end
  36.  
  37. fields=0
  38.  
  39. do count=selected.1 to selected.location
  40.    if crnumtype(count)="CLIP" | crnumtype(count)=" STIL" |  crnumtype(count)="FRAM" then
  41.       fields=fields+crnumgettag(count,Duration)
  42. end
  43.  
  44. hours=0
  45. minutes=0
  46. seconds=0
  47. frame=0
  48.  
  49. fields=F2D(fields)
  50.  
  51. if fields>=216000 then do
  52.    hours=fields%216000
  53.    fields=fields-(hours*216000)
  54.    end
  55. if fields>=3600 then do
  56.    minutes=fields%3600
  57.    fields=fields-(minutes*3600)
  58.    end
  59. if fields>=60 then do
  60.    seconds=fields%60
  61.    fields=fields-(seconds*60)
  62.    end
  63. frames=(fields%2)
  64.  
  65. time=req_tell("Total time of clips:","               "||right('00'||hours,2)||":"||right('00'||minutes,2)||":"||right('00'||seconds,2)||":"||right('00'||frames,2))
  66.  
  67. call projectupdate()
  68. call req_error("")
  69. call remlib("PROJECT_REXX_PORT")
  70. exit
  71.  
  72. quit:
  73.  
  74. call req_error("Canceled.")
  75. call remlib("PROJECT_REXX_PORT")
  76.  
  77. exit
  78.  
  79. croutonselectedpos:
  80. arg pos
  81.   row=pos%8
  82.   col=pos-(row*8)
  83.   row=row+1
  84. return croutonselected(row,col)
  85.  
  86. F2D: PROCEDURE  /* Convert Fields to dropframe. */
  87. arg fields
  88.  
  89. ticks=fields%2
  90.  
  91. extra=0;frms=ticks
  92.  
  93. do while (ticks >= 17982)
  94.   extra = extra + 2 * 9
  95.   ticks = ticks - 17982
  96.   end
  97.  
  98. if ticks >= 2 then
  99.   extra = extra + 2 * ((ticks-2)%1798)
  100.  
  101. /* Ouchy! Dropframe is such a pain!!!! */
  102.  
  103. return((frms+extra)*2)
  104.